package com.xioz.android;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;

/**
 * GameObject class
 * used for anything that should have a state on the screen that can be interated with
 * 
 * @author Zong Xiong
 */
public class GameObject {


/***************************************************
 * Fields
 ***************************************************/
	
	// stores position
    public Vector2 position;
    // stores width
    public float width;
    // stores height
    public float height;
    

/***************************************************
 * Public Methods
 ***************************************************/
    
    /**
     * Default Constructor
     * constructs an object at x,y with width and height
     * 
     * @param x
     * @param y
     * @param inWidth
     * @param inHeight
     */
    public GameObject(float x, float y, float inWidth, float inHeight) {
        this.position = new Vector2(x,y);
        this.width = inWidth;
        this.height = inHeight;
    }
    
    /**
     * getX
     * retrieves x position
     * 
     * @return x position
     */
    public float getX() {
    	return this.position.x;
    }
    
    /**
     * getY
     * retrieves y position
     * 
     * @return y position
     */
    public float getY() {
    	return this.position.y;
    }
    
    /**
     * contains
     * checks if the vector of a point is within the object
     * 
     * @param point, point to check if within the object
     * @return true if point is within the object
     */
    public boolean contains(Vector3 point) {
        return (point.x > this.position.x && point.x < this.position.x + width 
        		&& point.y > this.position.y && point.y < this.position.y + height);
    }
}
